Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings whitelist #892

Merged
merged 2 commits into from
Apr 14, 2018
Merged

Settings whitelist #892

merged 2 commits into from
Apr 14, 2018

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Feb 14, 2018

When merged this pull request will:

Adds cba_settings_whitelist[] array to both addon and mission config (description.ext).
The dedicated client/player can edit server tab settings if and only if any of these apply:

  • their UID (getPlayerUID) appears inside either array
  • both arrays are either empty or undefined and the player is a logged in admin
  • the "admin" wildcard was used in either array and the player is a logged in admin

If you want nobody to edit the settings, not even the logged in admin, then you can use a throwaway UID (e.g. "nobody") in either addon or mission config array.

By default, both of them are undefined/empty, so point #2 applies (logged in admin can edit the settings which is the current behavior before this PR).

In SP or as Local Host, you can edit the settings regardless of this whitelist.

This requires putting down UID's in either a global addon or the mission config, so if you're worried about spoofing, don't use it :~)

Future improvement could be made by comparing the players UID on the server instead, but I don't feel like writing a callback system for this stuff atm. This way you could use a server machine local addon to compare the UID.

@commy2 commy2 added the Feature label Feb 14, 2018
@commy2 commy2 added this to the 3.7 milestone Feb 14, 2018
@commy2
Copy link
Contributor Author

commy2 commented Feb 14, 2018

Waiting for feedback from @chris579.

@klemmchr
Copy link
Contributor

Like it!

// admin wildcard and local machine is logged in admin
if ("admin" in _whitelist && {IS_ADMIN_LOGGED}) exitWith {true};

_uid in _whitelist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe _whitelist should be GVAR and set at mission init, then FUNC(whitelisted) become getPlayerUID player in GVAR(whitelist)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, "admin" in GVAR(whitelist) && {IS_ADMIN_LOGGED} || {getPlayerUID player in GVAR(whitelist)}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then you can't set it with addon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would give the ability to dynamically add entries to the variables. Meaning admins with debug console access can just add themselves to the list. Which is exactly what the original Request wanted to prevent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also true. But with the debug console, you can mess with the settings anyway if you know what you're doing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then you can't set it with addon.

why? configFile/QGVAR(whitelist) should exist on mission init.

Copy link
Contributor

@dedmen dedmen Feb 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can mess with the settings anyway if you know what you're doing.

But not with config files.

But then you can't set it with addon.

Think commy missunderstood. ala GVAR != config.

I prefer the current state.

Copy link
Contributor

@Dystopian Dystopian Feb 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current state doesn't give any additional security because like commy2 said you can easily manage settings manually with debug console. But ability to change whitelist during mission could be helpful in some cases.

@Killswitch00 Killswitch00 merged commit 626fb6b into master Apr 14, 2018
@commy2 commy2 deleted the settings-whitelist branch April 22, 2018 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add whitelist for server settings editing
5 participants